package model.sequent.tokens;

import model.sequent.SequentToken;

/**
 * Represents an expression with only one argument.
 * 
 * @author Karen Berntsen (s0815799)
 * @author Erik Stens (s0615374)
 */
public class SimpleOperatorExpression implements Expression {
	private Expression		expression;
	private SequentToken	operator;
	
	public SimpleOperatorExpression(Expression expression, SequentToken operator) {
		this.expression = expression;
		this.operator = operator;
	}
	
	public Expression getExpression() {
		return expression;
	}
	
	public SequentToken getOperator() {
		return operator;
	}
	
	@Override
	public int hashCode() {
		return expression.hashCode() ^ operator.hashCode();
	}
	
	@Override
	public boolean equals(Object o) {
		if (o instanceof SimpleOperatorExpression) {
			SimpleOperatorExpression soe = (SimpleOperatorExpression) o;
			return operator == soe.getOperator() && expression.equals(soe.expression);
		}
		return false;
	}
	
	@Override
	public SimpleOperatorExpression clone() {
		return new SimpleOperatorExpression(expression.clone(), operator);
	}
}
